﻿<%@ Page Language="C#" MasterPageFile="../main.master" Inherits="VioletDevelopmentLaboratory.Net.Web.Configuration.VWebConfigManagerPage" %>

<script runat="server">
	protected void SessionStateDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
	{
		ShowAlert_DetailsView_ItemUpdated(e);
	}

	protected void ProvidersGridView_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
	{
		ProvidersDetailsView.ChangeMode(DetailsViewMode.ReadOnly);
	}

	protected void ProvidersDetailsView_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
	{
		ShowAlert_DetailsView_ItemInserted(e);

		ProvidersGridView.SelectedIndex = -1;
		ProvidersGridView.DataBind();
	}

	protected void ProvidersDetailsView_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
	{
		ShowAlert_DetailsView_ItemUpdated(e);

		ProvidersGridView.SelectedIndex = -1;
		ProvidersGridView.DataBind();
	}

	protected void ProvidersDetailsView_ItemDeleted(object sender, DetailsViewDeletedEventArgs e)
	{
		ShowAlert_DetailsView_ItemDeleted(e);

		ProvidersDetailsView.ChangeMode(DetailsViewMode.Insert);
		
		ProvidersGridView.SelectedIndex = -1;
		ProvidersGridView.DataBind();
	}
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPlaceHolder" Runat="Server">

	<h2>SessionState</h2>

	<div>
		<asp:ObjectDataSource ID="SessionStateDetailsViewDataSource" runat="server" 
			SelectMethod="GetSessionState" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.SessionStateSectionManager" 
			UpdateMethod="Modify">
			<UpdateParameters>
				<asp:Parameter Name="allowCustomSqlDatabase" Type="Boolean" />
				<asp:Parameter Name="cookieless" Type="Object" />
				<asp:Parameter Name="cookieName" Type="String" />
				<asp:Parameter Name="customProvider" Type="String" />
				<asp:Parameter Name="mode" Type="Object" />
				<asp:Parameter Name="partitionResolverType" Type="String" />
				<asp:Parameter Name="regenerateExpiredSessionId" Type="Boolean" />
				<asp:Parameter Name="sessionIDManagerType" Type="String" />
				<asp:Parameter Name="sqlCommandTimeout" Type="Object" />
				<asp:Parameter Name="sqlConnectionString" Type="String" />
				<asp:Parameter Name="StateConnectionString" Type="String" />
				<asp:Parameter Name="stateNetworkTimeout" Type="Object" />
				<asp:Parameter Name="timeout" Type="Object" />
				<asp:Parameter Name="useHostingIdentity" Type="Boolean" />
			</UpdateParameters>
		</asp:ObjectDataSource>
		<fieldset>
			<asp:DetailsView ID="SessionStateDetailsView" runat="server" 
				AutoGenerateRows="False" CellPadding="5" 
				DataSourceID="SessionStateDetailsViewDataSource" DefaultMode="Edit" 
				onitemupdated="SessionStateDetailsView_ItemUpdated">
				<Fields>
					<asp:CheckBoxField DataField="AllowCustomSqlDatabase" 
						HeaderText="AllowCustomSqlDatabase" SortExpression="AllowCustomSqlDatabase" />
					<asp:BoundField DataField="CookieName" HeaderText="CookieName" 
						SortExpression="CookieName" />
					<asp:TemplateField HeaderText="Cookieless" SortExpression="Cookieless">
						<EditItemTemplate>
							<asp:DropDownList ID="CookielessDropDownList" runat="server"
								SelectedValue='<%# Bind("Cookieless") %>'>
								<asp:ListItem>AutoDetect</asp:ListItem>
								<asp:ListItem>UseCookies</asp:ListItem>
								<asp:ListItem>UseDeviceProfile</asp:ListItem>
								<asp:ListItem>UseUri</asp:ListItem>
							</asp:DropDownList>
						</EditItemTemplate>
					</asp:TemplateField>
					<asp:BoundField DataField="CustomProvider" HeaderText="CustomProvider" 
						SortExpression="CustomProvider" />
					<asp:TemplateField HeaderText="Mode" SortExpression="Mode">
						<EditItemTemplate>
							<asp:DropDownList ID="ModeDropDownList" runat="server" SelectedValue='<%# Bind("Mode") %>'>
								<asp:ListItem>Custom</asp:ListItem>
								<asp:ListItem>InProc</asp:ListItem>
								<asp:ListItem>Off</asp:ListItem>
								<asp:ListItem>SQLServer</asp:ListItem>
								<asp:ListItem>StateServer</asp:ListItem>
							</asp:DropDownList>
						</EditItemTemplate>
					</asp:TemplateField>
					<asp:BoundField DataField="PartitionResolverType" 
						HeaderText="PartitionResolverType" SortExpression="PartitionResolverType" />
					<asp:CheckBoxField DataField="RegenerateExpiredSessionId" 
						HeaderText="RegenerateExpiredSessionId" 
						SortExpression="RegenerateExpiredSessionId" />
					<asp:BoundField DataField="SessionIDManagerType" 
						HeaderText="SessionIDManagerType" SortExpression="SessionIDManagerType" />
					<asp:BoundField DataField="StateConnectionString" 
						HeaderText="StateConnectionString" SortExpression="StateConnectionString" />
					<asp:BoundField DataField="StateNetworkTimeout" 
						HeaderText="StateNetworkTimeout" SortExpression="StateNetworkTimeout" />
					<asp:BoundField DataField="SqlConnectionString" 
						HeaderText="SqlConnectionString" SortExpression="SqlConnectionString" />
					<asp:BoundField DataField="SqlCommandTimeout" HeaderText="SqlCommandTimeout" 
						SortExpression="SqlCommandTimeout" />
					<asp:CheckBoxField DataField="UseHostingIdentity" 
						HeaderText="UseHostingIdentity" SortExpression="UseHostingIdentity" />
					<asp:BoundField DataField="Timeout" HeaderText="Timeout" 
						SortExpression="Timeout" />
					<asp:CommandField ButtonType="Button" ShowCancelButton="False" 
						ShowEditButton="True" />
				</Fields>
			</asp:DetailsView>
		</fieldset>
	</div>

	<div style="margin-left : 30px">
		<asp:ObjectDataSource ID="ProvidersDetailsViewDataSource" runat="server" 
			DeleteMethod="RemoveProvider" InsertMethod="AddProvider" 
			SelectMethod="GetProvider" 
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.SessionStateSectionManager" 
			UpdateMethod="ModifyProvider">
			<DeleteParameters>
				<asp:Parameter Name="name" Type="String" />
			</DeleteParameters>
			<UpdateParameters>
				<asp:Parameter Name="name" Type="String" />
				<asp:Parameter Name="type" Type="String" />
			</UpdateParameters>
			<SelectParameters>
				<asp:ControlParameter ControlID="ProvidersGridView" Name="name" 
					PropertyName="SelectedValue" Type="String" />
			</SelectParameters>
			<InsertParameters>
				<asp:Parameter Name="name" Type="String" />
				<asp:Parameter Name="type" Type="String" />
			</InsertParameters>
		</asp:ObjectDataSource>
		<asp:ObjectDataSource ID="ProvidersGridViewDataSource" runat="server" 
			SelectMethod="GetProviders" 
			
			TypeName="VioletDevelopmentLaboratory.Net.Web.Configuration.SessionStateSectionManager"></asp:ObjectDataSource>
		<fieldset>
			<legend>providers</legend>
			<asp:DetailsView ID="ProvidersDetailsView" runat="server" 
				AutoGenerateRows="False" CellPadding="5" DataKeyNames="Name" 
				DataSourceID="ProvidersDetailsViewDataSource" DefaultMode="Insert" 
				oniteminserted="ProvidersDetailsView_ItemInserted" 
				onitemupdated="ProvidersDetailsView_ItemUpdated" 
				onitemdeleted="ProvidersDetailsView_ItemDeleted">
				<Fields>
					<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" 
						ReadOnly="True" />
					<asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
					<asp:CommandField ButtonType="Button" ShowDeleteButton="True" 
						ShowEditButton="True" ShowInsertButton="True" />
				</Fields>
			</asp:DetailsView>
			<asp:GridView ID="ProvidersGridView" runat="server" AutoGenerateColumns="False" 
				CellPadding="5" DataKeyNames="Name" DataSourceID="ProvidersGridViewDataSource" 
				onselectedindexchanging="ProvidersGridView_SelectedIndexChanging">
				<Columns>
					<asp:CommandField ShowSelectButton="True" />
					<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
					<asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
				</Columns>
				<SelectedRowStyle BackColor="SkyBlue" />
			</asp:GridView>
		</fieldset>
	</div>
</asp:Content>